<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#INCLUDE FILE="config.asp"-->
<%
 if(Session("SalesAccessLevel") <> 1 and Session("SalesAccessLevel") <> 4 ) then
	Response.Redirect("default.asp?msg=invalid")
end if

if (Request("pID") <> "") then
	guestId = Request("pID")
	
	sqlstring = "SELECT * FROM Guests WHERE GuestID = "&guestId
	
	set objConnect1 = server.createObject("ADODB.Connection")   

	objConnect1.Open conStr

	set TblTemp1 = server.createobject("Adodb.Recordset")
		
		TblTemp1.Open sqlstring, objConnect1
		
	If not TblTemp1.EOF then
		Email = TblTemp1("Email")
		FirstN = TblTemp1("Name")
		LastN = TblTemp1("Surname")
	end if
end if


%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- DATE PICKER SCRIPT -->
<link type="text/css" href="../css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		skin : "o2k7",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example word content CSS (should be your site CSS) this one removes paragraph margins
		content_css : "css/word.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<script type="text/javascript">
$(function() {
    $('#list_table tr:nth-child(2n+1)').addClass('alternate');
	
	$("#contentOfEmail").change(function(){
		$.ajax({	
			type:"POST",
			url: "ChooseContentEmailProcess.asp",
			dataType: "html",
			data: {filename:$("#contentOfEmail").val(), guestID:$("#guestid").val()},
			async: false,
			success: function(data){ 
				tinyMCE.activeEditor.setContent(data, {format : 'raw'});
			}
		});
		return false;
	});

	$("#sendmail").click(function(){
		var body = tinyMCE.activeEditor.getContent();
		$.ajax({	
			type:"POST",
			url: "SendFinalEmailProcess.asp",
			dataType: "html",
			data: {emailto:$("#Emailto").val(), subject:$("#subject").val(), content:body, guestid:$("#guestid").val(),nameGuest:$("#Fullname").val(),attach:$("#attachpdf").val()},
			async: false,
			success: function(data){ 
				$('#error').html(data);
			}
		});
		return false;
	});

});
</script>

<title>Sales Send Email :: CostaBaja</title>

</head>
<body>

<div id="main_wrapper">
    	<div class="main_wrapper_margin">
        	
            <div class="admin_top_menu">
            <!--#INCLUDE FILE="sales_menu.asp"--> 
           	</div><!-- END admin_top_menu -->
             
			<h1>Email Reservation</h1>
            <div class="clear"></div>
               <hr/>
            <div class="dashboad_wrapper">
       <form id="extend">
			 <table cellpadding="0" width="100%">
				<tr>
					<td width="33%">
            		<label>Subject: </label><br />
					<input type="text" name="subject" id="subject" value=""/>
  					</td>
				</tr>
				<tr>
					<td width="33%">
            		<label>To: </label><br />
					<input type="text" name="Fullname" id="Fullname" value="<%=LastN%> <%=FirstN%>"/>
  					</td>
				</tr>
				<tr>
					<td width="33%">
            		<label>Email: </label><br />
					<input type="text" name="Emailto" id="Emailto" value="<%=Email%>"/>
  					</td>
				</tr>
				<tr>
				<td width="33%">
					<label>Choose content of Email: </label><br />
					<select name = "contentOfEmail" id="contentOfEmail">
					<option value="0">-- Seleccionar --</option>
					<option value="Availability-English">Availability-English</option>
					<option value="Reservation - English">Reservation - English</option>
					<option value="Reservation - Espanol">Reservation - Espanol</option>
					<option value="Follow-up_En">Follow-up - English</option>
					<option value="Fow-rsvsletter">Follow-up - Espanol</option>
					<option value="USA-RC-general-letterEN">USA RC general letterEN</option>
					<option value="CAN-FOWN-Vac-LetterEN">CAN FOWN Vac LetterEN</option>
					</select>
                 </td>
				 </tr>
				<tr>
					<td width="33%">
            		<label>Content Email: </label><br />
					<div id="updateArea">
					<textarea cols="90" rows="18" name="EmailContent" id="EmailContent">
					</textarea>
					</div>
  					</td>
				</tr>
				<br/>
				<br/>
				<br/>
				<tr>
				<td><label>Choose Pdf to attach: </label>
					<select name = "attachpdf" id="attachpdf">
					<option value="0">-- Seleccionar --</option>
					<option value="English">CC English</option>
					<option value="Espanol">CC Espanol</option>
					</select>
				</td>
				</tr>
				<tr>
				<td>
					<input type="hidden" name="guestid" id="guestid" value="<%=guestId%>"/>
	
					<input type="button"  value="Enviar" id="sendmail"/>
				</td>

				</tr>
            
			 </table>
       </form>      
 <span id ="error"></span>
            </div><!-- .dashboad_wrapper -->
                        
    	</div><!-- END .main_wrapper_margin -->
        
	</div><!-- END #main_wrapper -->

         <!-- FOOTER -->
         
         <!--#INCLUDE file="sales_footer.asp"-->
         
         <!-- END FOOTER -->   

</body>
</html>
